﻿<?php
session_start();

if(!isset($_SESSION['id'])){
	header('Location:login.php');
}
   $arrayid=$_POST['arrayid'];;
   $id=$_GET['id'];
   $connect=mysql_connect("localhost","root","");
   mysql_select_db("shenji",$connect);
   mysql_query("set names utf8");
	if(isset($arrayid[0])){
		 foreach ($arrayid as $id){
		   //删除之前先判断是否是升级测试ID
		   $select_sql="select licesneid from jiekou where id=$id";
		   $result=mysql_query($select_sql);
		   $row=mysql_fetch_array($result);
		   $licesneid=$row[0];

		   if($licesneid!='升级测试ID'){
			   $sql="delete from jiekou where id=$id";
			   mysql_query($sql);
	       }
        }
	}
	 
   if(isset($id)){
	   //删除之前先判断是否是升级测试ID
	   $select_sql="select licesneid from jiekou where id=$id";
	   $result=mysql_query($select_sql);
	   $row=mysql_fetch_array($result);
	   $licesneid=$row[0];
	   if($licesneid=='升级测试ID'){
		  echo "<script>alert('无法删除升级测试ID');location='select_jiekou.php'</script>";
	   }else{
		  $sql="delete from jiekou where id=$id";
	      mysql_query($sql);
		  echo "<script>location='select_jiekou.php'</script>";
	   }
	  
   }
     
	
?>